
#ifndef _PYHIGHLIGHTER_H_
#define _PYHIGHLIGHTER_H_

#include <QString>
#include <QFont>
#include <QSyntaxHighlighter>
#include <QTextCharFormat>
#include <QRegularExpression>
#include <QTextDocument>


#include "WidgetsApi.hpp"

namespace NSWidgets {

    class WIDGETSAPI PyHighlighter : 
        public QSyntaxHighlighter 
    {

    public:
        PyHighlighter(QTextDocument* parent = nullptr);
        ~PyHighlighter();

    protected:
        void highlightBlock(const QString& text) override;

    private:
        struct HighlightingRule {
            QRegularExpression pattern;
            QTextCharFormat format;
        };

        QVector<HighlightingRule> highlighting_rules;
        QRegularExpression comment_start_expression;
        QRegularExpression comment_end_expression;
        QTextCharFormat keyword_format;
        QTextCharFormat singleline_comment_format;
        QTextCharFormat multiline_comment_format;
        QTextCharFormat quotation_format;
        QTextCharFormat function_format;
    };



}

#endif



